<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <ui:composition >
        <p:panel id="ciabillingrequests" header="Billing Requests" >
            <p:ajaxStatus style="width:16px;height:16px;">  
                <f:facet name="start">  
                    <h:graphicImage value="/resources/design/ajaxloading.gif" />  
                </f:facet>  

                <f:facet name="complete">  
                    <h:outputText value="" />  
                </f:facet>  
            </p:ajaxStatus>  
            <p:dataTable value="#{billingRequestEntityController.allBillingRequestsForSalesOrder}" var="item" 
                         paginator="true" rows="30" rowsPerPageTemplate="30,50,100">
                <p:column filterBy="#{item.id}" sortBy="#{item.id}">
                    <f:facet name="header">
                        <h:outputText value="#{bundle.ListBillingRequestEntityTitle_id}"/>
                    </f:facet>
                    <h:outputText value="#{item.id}"/>
                </p:column>

                <p:column filterBy="#{item.salesOrder}" sortBy="#{item.salesOrder}">
                    <f:facet name="header">
                        <h:outputText value="#{bundle.ListBillingRequestEntityTitle_salesOrder}"/>
                    </f:facet>
                    <h:outputText value="#{item.salesOrder}"/>
                </p:column>

                <p:column filterBy="#{item.salesOrder.customer.fullname}" sortBy="#{item.salesOrder.customer.fullname}">
                    <f:facet name="header">
                        <h:outputText value="Customer"/>
                    </f:facet>
                    <h:outputText value="#{item.salesOrder.customer.fullname}"/>
                </p:column>

                <p:column filterBy="#{item.requestedAmount}" sortBy="#{item.requestedAmount}">
                    <f:facet name="header">
                        <h:outputText value="#{bundle.ListBillingRequestEntityTitle_requestedAmount}"/>
                    </f:facet>
                    <h:outputText value="#{item.requestedAmount}"/>
                </p:column>

                <p:column filterBy="#{item.invoice}" sortBy="#{item.invoice}">
                    <f:facet name="header">
                        <h:outputText value="#{bundle.ListBillingRequestEntityTitle_invoice}"/>
                    </f:facet>
                    <h:commandLink value="#{item.invoice.id}" rendered="#{item.hasInvoice()}"
                                   action="/entities/customerInvoiceEntity/ViewOnly?faces-redirect=true">
                        <f:setPropertyActionListener target="#{customerInvoiceEntityController.current}"
                                                     value="#{item.invoice}" />
                    </h:commandLink>
                </p:column>

                <p:column filterBy="#{item.createdAt.toString()}" sortBy="#{item.createdAt.toString()}">
                    <f:facet name="header">
                        <h:outputText value="#{bundle.ListBillingRequestEntityTitle_createdAt}"/>
                    </f:facet>
                    <h:outputText value="#{item.createdAt.toString()}">
                    </h:outputText>
                </p:column>
            </p:dataTable>
        </p:panel>

    </ui:composition>

</html>
